package com.pdg.mcplugin.misterdevtool;

import org.bukkit.command.CommandSender;

import com.pdg.mcplugin.common.ArgumentList;
import com.pdg.mcplugin.common.baseclasses.CommandProcessorBase;

public class DisableCommandProcessor extends
		CommandProcessorBase<MisterDevtool> {

	private static final String FORMAT_DISABLED_TOOL = "Disabled tool '%s'.";

	public DisableCommandProcessor(MisterDevtool thePlugin) {
		super(thePlugin, new String[]{});
	}

	@Override
	protected boolean specialProcessCommand(CommandSender theCommandSender,
			String theSubCommand, ArgumentList theArgumentList) {
		MDTFeatures theFeature = MDTFeatures.valueOf(theSubCommand.toUpperCase());
		if(theFeature!=null){
			getPlugin().sendSuccessMessage(theCommandSender, String.format(FORMAT_DISABLED_TOOL, theSubCommand));
			getPlugin().getFeatureManager().setFeature(theFeature, false);
			return true;
		}else{
			getPlugin().sendErrorMessage(theCommandSender, String.format(EnableCommandProcessor.FORMAT_NO_SUCH_TOOL, theSubCommand));
			return true;
		}
	}

}
